package com.guyaning.testmvp;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;

import com.blankj.utilcode.util.ToastUtils;
import com.guyaning.deyson_core.core.activities.ProxyActivity;
import com.guyaning.deyson_core.core.app.Deyson;
import com.guyaning.deyson_core.core.delegates.DeysonDelegate;
import com.guyaning.deyson_ec.ec.launcher.ILauncherListener;
import com.guyaning.deyson_ec.ec.launcher.LauncherDelegate;
import com.guyaning.deyson_ec.ec.launcher.OnLauncherFinishTag;
import com.guyaning.deyson_ec.ec.main.EcBottomDelegate;
import com.guyaning.deyson_ec.ec.sign.ISignListener;

import qiu.niorgai.StatusBarCompat;

public class MainActivity extends ProxyActivity implements ISignListener, ILauncherListener {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }

        Deyson.getConfigurator().withActivity(this);

        StatusBarCompat.translucentStatusBar(this,true);
    }

    @Override
    public DeysonDelegate setRootDelegate() {
        return new LauncherDelegate();
    }

    @Override
    public void onSignInSuccess() {
        ToastUtils.showShort("登录成功");
    }

    @Override
    public void onSignUpSuccess() {
        ToastUtils.showShort("注册成功");
    }

    @Override
    public void onLauncherFinish(OnLauncherFinishTag tag) {
        switch (tag) {
            case SIGNED:
                ToastUtils.showShort("登录成功");
//                startWithPop(new ExampleDelegate());
                startWithPop(new EcBottomDelegate());
                break;
            case NOT_SIGNED:
                ToastUtils.showShort("没有登录");
                startWithPop(new EcBottomDelegate());
//                startWithPop(new SignInDelegate());
                break;
            default:
                break;
        }
    }
}
